﻿<Window x:Class="ProductKeyManager.ProductDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ui="clr-namespace:ProductKeyManager.UI"
    Style="{DynamicResource ProductDialog}"
    Title="New Product" Loaded="WindowLoaded" WindowStartupLocation="CenterOwner">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="../Resources/ProductDialogResources.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <DockPanel>
        <DockPanel LastChildFill="True" DockPanel.Dock="Top">
            <DockPanel DockPanel.Dock="Top" Style="{StaticResource PanelBackground}">
                <Label Name="lblProductName" Style="{StaticResource ProductNameLabel}">Product Name:</Label>
            </DockPanel>
            <ToggleButton IsChecked="False" DockPanel.Dock="Right" Name="btnNotes">
                <Image Style="{StaticResource JournalToolbarIcon}"/>
                <ToggleButton.ToolTip>
                    <StackPanel>
                        <Label Style="{StaticResource ToolTipTitle}">
                            Notes
                        </Label>
                        <TextBlock Style="{StaticResource ToolTipTextBlock}">You can add notes to products for additional information.</TextBlock>
                    </StackPanel>
                </ToggleButton.ToolTip>
            </ToggleButton>
            <ComboBox DockPanel.Dock="Right" Name="cmbIcon" ItemsSource="{Binding}">
                <ComboBox.ToolTip>
                    <StackPanel>
                        <Label Style="{StaticResource ToolTipTitle}">
                            Icon
                        </Label>
                        <TextBlock Style="{StaticResource ToolTipTextBlock}">Choose the icon to display with this product</TextBlock>
                    </StackPanel>
                </ComboBox.ToolTip>
                <ComboBox.ItemTemplate>
                    <DataTemplate>
                        <Image Source="{Binding}" Style="{StaticResource ToolbarIcon}"/>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <TextBox Name="txtProductName" Style="{StaticResource ProductName}" Text="{Binding Path=Name}"/>
        </DockPanel>
        <ToolBarTray DockPanel.Dock="Bottom" IsLocked="True">
            <ToolBar Name="AddEditToolbar">
                <Button Name="btnAddKeyCode" Click="AddKeyCode">
                    <Image Style="{StaticResource NewToolbarIcon}"/>
                    <Button.ToolTip>
                        <StackPanel>
                            <Label Style="{StaticResource ToolTipTitle}">
                                Add Key
                            </Label>
                            <TextBlock Style="{StaticResource ToolTipTextBlock}">This adds a new key to the current product</TextBlock>
                        </StackPanel>
                    </Button.ToolTip>
                </Button>
                <Button Name="btnRemoveKeyCode" Click="RemoveKeyCode">
                    <Image Style="{StaticResource DeleteToolbarIcon}"/>
                    <Button.ToolTip>
                        <StackPanel>
                            <Label Style="{StaticResource ToolTipTitle}">
                                Delete Key
                            </Label>
                            <TextBlock Style="{StaticResource ToolTipTextBlock}">This deletes the selected key from this product</TextBlock>
                        </StackPanel>
                    </Button.ToolTip>
                </Button>
                <TextBox Text="{Binding Path=Code}" Style="{StaticResource KeyAllocToolBarTextBox}"/>
                <TextBox Text="{Binding Path=AllocatedTo}" Style="{StaticResource KeyAllocToolBarTextBox}"/>
                <Button Visibility="Collapsed">
                    <Image Source="Icons/Generic_Document.ico" Width="16" Height="16"/>
                    <Button.ToolTip>
                        <StackPanel>
                            <Label Style="{StaticResource ToolTipTitle}">
                                Notes
                            </Label>
                            <TextBlock Style="{StaticResource ToolTipTextBlock}">Notes</TextBlock>
                        </StackPanel>
                    </Button.ToolTip>
                </Button>
            </ToolBar>
        </ToolBarTray>
        <StackPanel>
            <ListBox Name="lstProdKeys" MinHeight="200" MaxHeight="400" ItemsSource="{Binding}" SelectionMode="Single" IsSynchronizedWithCurrentItem="True" >
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <Label Style="{StaticResource KeyAllocToolBarLabel}" Content="Key: "/>
                            <Label Style="{StaticResource KeyAllocToolBarValue}" Content="{Binding Path=Code}"/>
                            <Label Style="{StaticResource KeyAllocToolBarLabel}" Content="Allocated To: "/>
                            <Label Style="{StaticResource KeyAllocToolBarValue}" Content="{Binding Path=AllocatedTo}"/>
                        </StackPanel>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
            <DockPanel Name="pnlProductNotes" LastChildFill="True" Visibility="Collapsed">
                <DockPanel DockPanel.Dock="Top" Style="{StaticResource PanelBackground}">
                    <Label Style="{StaticResource ProductNameLabel}" Content="Product Notes"/>
                </DockPanel>
                <TextBox Name="txtNotes" Style="{StaticResource ProductNotesTextBox}" Text="{Binding Path=Notes}"/>
            </DockPanel>
        </StackPanel>
    </DockPanel>
</Window>
